package com.ruoyi.common.core.web.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

@Configuration
public class ApplicationConfig {

    /**
     * 国际化
     *
     * @return
     */
    @Bean(name = "messageSource")
    @ConditionalOnMissingBean
    public ResourceBundleMessageSource getMessageSource() {
        ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
        resourceBundleMessageSource.setDefaultEncoding("UTF-8");
        resourceBundleMessageSource.setCacheSeconds(3601);
        resourceBundleMessageSource.addBasenames("i18n/messages", "i18n/messagesAuth", "i18n/messagesCore");
        return resourceBundleMessageSource;
    }
}
